import request from '@/config/axios'

// 派工单 VO
export interface DispatchListVO {
  id: number // 主键ID
  shipmentDate: Date // 出货时间
  customer: string // 客户
  ticketNumber: string // 票号
  internalNumber: string // 厂内编号
  modelKp: string // 型号（KP）
  flex: string // FLEX
  hammerPlateStructure: string // 打击板结构
  hammerPlateModel: string // 打击板模号
  direction: string // 方向
  quantity: number // 数量
  productLength: number // 长度
  tcf: string // T/C/F
  st1271: string // ST1271
  remark: string // 备注
  bat: string // 是否待定
}

// 派工单 API
export const DispatchListApi = {
  // 查询派工单分页
  getDispatchListPage: async (params: any) => {
    return await request.get({ url: `/project/dispatch-list/page`, params })
  },

  // 查询派工单详情
  getDispatchList: async (id: number) => {
    return await request.get({ url: `/project/dispatch-list/get?id=` + id })
  },

  // 新增派工单
  createDispatchList: async (data: DispatchListVO) => {
    return await request.post({ url: `/project/dispatch-list/create`, data })
  },

  // 修改派工单
  updateDispatchList: async (data: DispatchListVO) => {
    return await request.put({ url: `/project/dispatch-list/update`, data })
  },

  // 删除派工单
  deleteDispatchList: async (id: number) => {
    return await request.delete({ url: `/project/dispatch-list/delete?id=` + id })
  },

  // 导出派工单 Excel
  exportDispatchList: async (params) => {
    return await request.download({ url: `/project/dispatch-list/export-excel`, params })
  }
}
